﻿<%@page import="java.text.SimpleDateFormat"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8" import="database.DAO, golf.Account, golf.ProductService"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>회원 정보 보기</title>
</head>
<body bgcolor="white" text="black" link="blue" vlink="purple" alink="red">
<h1>회원 정보 보기</h1>

<%
DAO dao = DAO.getInstance();
Account account = dao.getAccount( (String)session.getAttribute("accountID") );
if( account == null ){
	out.println("로그인을 먼저 해주세요!");
}
else{
%>
<table align="center" cellpadding="0" cellspacing="0" width="80%">
    <tr>
        <td width="100"><span style="font-size:9pt;">아이디</span></td>
        <td width="500"><span style="font-size:9pt;"><%=account.getId() %></span></td>
    </tr>
    <tr>
        <td width="100"><span style="font-size:9pt;">주민등록번호</span></td>
        <td width="500"><span style="font-size:9pt;"><%=account.getJumin() %></span>        </td>
    </tr>
    <tr>
        <td width="100"><span style="font-size:9pt;">계정이름</span></td>
        <td width="500"><span style="font-size:9pt;"><%=account.getName() %></span>        </td>
    </tr>
    <tr>
        <td width="100"><span style="font-size:9pt;">계정비밀번호</span></td>
        <td width="500"><span style="font-size:9pt;"><%=account.getPassword() %></span>        </td>
    </tr>
    <tr>
        <td width="100"><span style="font-size:9pt;">결제정보</span></td>
        <td width="500"><span style="font-size:9pt;">
        <%
		if( account.getPs_no() != 0 ){
			//사용하고 있는 요금제 출력.
			ProductService ps = dao.getProductService(account.getPs_no());
			
			SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd");
			java.util.Calendar cal = java.util.Calendar.getInstance();
			
			cal.setTime(account.getPs_buy_date());
			cal.add(java.util.Calendar.DATE, ps.getPeriod() );
		%>
			<table cellspacing="0" width="100%" border="1" bordercolordark="white" bordercolorlight="black">
		        <tr>
		            <td width="100"><span style="font-size:9pt;">요금상품명</span></td>
		            <td width="50"><span style="font-size:9pt;">가격</span></td>
		            <td width="50"><span style="font-size:9pt;">구입날짜</span></td>
		            <td width="50"><span style="font-size:9pt;">만료날짜</span></td>
		            <td width="50"><span style="font-size:9pt;">상품등급명</span></td>
		            <td width="50"><span style="font-size:9pt;">경험치 추가</span></td>
		            <td width="50"><span style="font-size:9pt;">상금 추가</span></td>
		            <td width="70"><span style="font-size:9pt;">코스그린피 추가</span></td>
		        </tr>
		        <tr>
		        	<td width="100"><span style="font-size:9pt;"><%=ps.getName() %></span></td>
		            <td width="50"><span style="font-size:9pt;"><%=ps.getPrice() %></span></td>
		            <td width="50"><span style="font-size:9pt;"><%=account.getPs_buy_date().toString() %></span></td>
		            <td width="50"><span style="font-size:9pt;"><%=sdf.format(cal.getTime()) %></span></td>
		            <td width="50"><span style="font-size:9pt;"><%=ps.getGrade_name() %></span></td>
		            <td width="50"><span style="font-size:9pt;"><%=ps.getGrade_exp() %></span></td>
		            <td width="50"><span style="font-size:9pt;"><%=ps.getGrade_prize() %></span></td>
		            <td width="80"><span style="font-size:9pt;"><%=ps.getGrade_course_green_fee() %></span></td>            
		        </tr>
			</table>
			<%} 
			else{
				out.println("사용중인 요금제가 없습니다.");
			}%>
        
        </span>        </td>
    </tr>
</table>
<%} %>
</body>

</html>